import sys
import os.path
import time
import datetime
from django.shortcuts import *
from django.http import HttpResponse, HttpResponseRedirect
from django.template.loader import render_to_string
from google.appengine.api import users
from django.http import Http404
from django.template import TemplateDoesNotExist
from django.conf.urls.defaults import *

from google.appengine.api import urlfetch
from xml.etree import ElementTree
from google.appengine.api import memcache
from app.context import HttpContext
from django.views.decorators.cache import cache_page
import settings

#---------------- request handlers ---------------------------------------------

@cache_page(60*10)
def page(request, tag='index'):
	context = HttpContext(request)
	tag = tag.lower()
	
	posts = get_posts(tag=tag)
	if not posts:
		raise Http404
	
	etokens = {
		'tag': tag,
		'title': title,
		'posts': posts,
	}
	
	return context.render(template='page.html', extra_tokens=etokens)






urlpatterns = patterns('',
	url(r'(.+)^$', page, name='public.page')
)